import pandas as pd
import numpy as np

class MarkdownConverter:
    
    @staticmethod
    def convert_to_markdown(data):
        if isinstance(data, pd.DataFrame):
            return MarkdownConverter._dataframe_to_markdown(data)
        elif isinstance(data, pd.Series):
            return MarkdownConverter._series_to_markdown(data)
        elif isinstance(data, list):
            return MarkdownConverter._list_to_markdown(data)
        elif isinstance(data, dict):
            return MarkdownConverter._dict_to_markdown(data)
        elif isinstance(data, str):
            return MarkdownConverter._string_to_markdown(data)
        elif isinstance(data, np.ndarray):
            return MarkdownConverter._numpy_to_markdown(data)
        else:
            f"Unsupported data type: {type(data)}"
            return str(data)

    @staticmethod
    def _dataframe_to_markdown(df):
        """Converts a DataFrame to a markdown table."""
        return df.to_markdown(index=False)

    @staticmethod
    def _series_to_markdown(series):
        """Converts a Series to a markdown table."""
        return series.to_frame().to_markdown(header=[series.name])

    @staticmethod
    def _list_to_markdown(lst):
        """Converts a list to a markdown list."""
        return '\n'.join(f"- {item}" for item in lst)

    @staticmethod
    def _dict_to_markdown(dct):
        """Converts a dictionary to a markdown list."""
        return '\n'.join(f"- **{key}**: {value}" for key, value in dct.items())

    @staticmethod
    def _string_to_markdown(string):
        """Converts a string to a markdown text."""
        return string

    @staticmethod
    def _numpy_to_markdown(array):
        """Converts a NumPy array to a markdown table or list."""
        if array.ndim == 1:
            # One-dimensional array: convert to a list format
            return MarkdownConverter._list_to_markdown(array.tolist())
        elif array.ndim == 2:
            # Two-dimensional array: convert to a markdown table
            df = pd.DataFrame(array)
            return MarkdownConverter._dataframe_to_markdown(df)
        else:
            # For higher dimensions, flatten the array and then convert to a list
            flattened = array.flatten().tolist()
            return MarkdownConverter._list_to_markdown(flattened)

# Example usage:
if __name__ == "__main__":
    converter = MarkdownConverter()

    df = pd.DataFrame({
        'Name': ['Alice', 'Bob', 'Charlie'],
        'Age': [25, 30, 35],
        'City': ['New York', 'San Francisco', 'Los Angeles']
    })

    series = pd.Series([1, 2, 3], name='Numbers')

    my_list = ['Apple', 'Banana', 'Cherry']

    my_dict = {'Name': 'Alice', 'Age': 25, 'City': 'New York'}

    my_string = "This is a simple string."

    array_1d = np.array([1, 2, 3, 4, 5])
    array_2d = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])

    print(converter.convert_to_markdown(df))
    print(converter.convert_to_markdown(series))
    print(converter.convert_to_markdown(my_list))
    print(converter.convert_to_markdown(my_dict))
    print(converter.convert_to_markdown(my_string))
    print(converter.convert_to_markdown(array_1d))
    print(converter.convert_to_markdown(array_2d))
